<template>
  <div class="view-container">
    <el-header>
      <el-form :inline="true" class="demo-form-inline">


        <el-form-item>

          <el-button type="primary" @click="showDetail">修改</el-button>
          <el-button type="primary">删除</el-button>
        </el-form-item>
      </el-form>
    </el-header>

    <el-main>
      <el-table
        ref="multipleTable"
        :data="tableData"
        tooltip-effect="dark"
        style="width: 100%"

        @select="handleSelectionChange"


      >

        <el-table-column
          type="selection"
          width="55">
        </el-table-column>
        <el-table-column
          label="标题"
          width="1200px">
          <template slot-scope="scope"><el-link>{{ scope.row.receiptContent }}</el-link></template>
        </el-table-column>
        <el-table-column
          prop="receiptDate"
          label="来文日期"
          show-overflow-tooltip>
        </el-table-column>
        <el-table-column
          prop="codeName"
          label="来文文号"
          show-overflow-tooltip>
        </el-table-column>

        <el-table-column
          prop="storePeriod"
          label="收文号"
          show-overflow-tooltip>
        </el-table-column>

        <el-table-column
          prop="auditor"
          label="审核人"
          show-overflow-tooltip>
        </el-table-column>

      </el-table>

      <div class="block">
        <span class="demonstration"></span>
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page.sync="currentPage2"
          :page-sizes="[5, 10, 15, 20]"
          :page-size="1"
          layout="sizes, prev, pager, next"
          :total=dataLoh>
        </el-pagination>
      </div>
    </el-main>


  </div>
</template>

<script>

  // huizongChakan
  import huizongsel from "@/api/huizongChakan/huizongsel";
  import listMixin from '@/mixin/listMixin'
  import daiyue from "@/api/shouwen/gueidang";

  export default {
    name: "zichanmingxi",
    mixins:[listMixin],
    data() {
      return {
        pid:"",
        userALL:{

          pageIndex:1,
          pageSize:5,
        },
        updateID:0,
        dataLoh:1,
        ids:[],
        currentPage2:5,
        formInline:{},
        tableData: [],
      }
    },
    created() {
      this.sleall()
    },
    methods: {


      //点击行获取ID
      btn_user(row) {
        console.log(row.infoId)
        this.showDetails(row.infoId)
      },
      //跳转修改页面
      showDetail(){
        this.$router.push('/work-exchange/huizongUp')
        this.$router.id = this.updateID
      },

      //跳转详情页面
      showDetails(id){
        this.$router.push('/work-exchange/xiangqing')
        this.$router.id = id
      },
      //分页
      handleSizeChange(val) {
        this.userALL.pageSize = val
        console.log(`每页 ${this.userALL.pageSize} 条`);
        this.sleall()
      },
      fetchData(){

      },
      handleCurrentChange(val) {
        this.userALL.pageIndex = val

        console.log(`当前页: ${this.userALL.pageIndex}`);
        this.sleall()
      },
      //复选框事件
      handleSelectionChange(val) {
        this.updateID=val[0].infoId
        // console.log(val[0].infoId) ;
        this.ids=[]
        for (const i of val){
          this.ids[0]=i.infoId
          console.log(this.ids[0])
        }
      },
      //查询列表selzichan
      sleall(){
        daiyue.SelectFen(this.userALL).then(res=>{
          this.tableData = res.records
          this.dataLoh = res.total
          console.log(this.tableData)
        })
      },
      //删除
      // delHuiz(){
      //   ziChan.delHui(this.ids).then(res=>{
      //     this.sleall()
      //   })
      // }

    }
  }
</script>

<style scoped lang="scss">

</style>
